<?php

use Hyperf\Database\Schema\Schema;
use Hyperf\Database\Schema\Blueprint;
use Hyperf\Database\Migrations\Migration;

class CreateTableTemporaryRecords extends Migration
{
    /**
     * Run the migrations.
     */
    public function up(): void
    {
        Schema::create('records_temporary', function (Blueprint $table) {
            $table->bigIncrements('id');
            $table->integer('device_id')->nullable(false)->comment('设备ID');
            $table->integer('record_id')->nullable(false)->comment('检测记录ID');
            $table->integer('category_id')->nullable(false)->comment('项目ID');
            $table->integer('standard_detail_id')->nullable(false)->comment('标准值详情ID');
            $table->string('index', 128)->nullable(false)->comment('参考范围');
            $table->string('cname', 64)->nullable()->comment('项目中文名称');
            $table->string('category_unit', 64)->nullable(false)->comment('单位');
            $table->tinyInteger('status')->nullable(false)->comment('状态: 0正常, 1异常');
            $table->string('result', 128)->nullable(false)->comment('检测结果');
            $table->integer('project_id')->nullable(false)->comment('项目ID');
            $table->string('bar_code', 128)->nullable(false)->comment('条码编号');
            $table->integer('created_at')->nullable(false)->default(0)->comment('创建时间');
        });
    }

    /**
     * Reverse the migrations.
     */
    public function down(): void
    {
        Schema::dropIfExists('records_temporary');
    }
}
